home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Tcl_GetInt(3) Tcl Library Procedures
-
-
-
- _________________________________________________________________
-
- NAME
- Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean - convert from
- string to integer, double, or boolean
-
- SYNOPSIS
- #include <tcl.h>
-
- int
- Tcl_GetInt(_i_n_t_e_r_p, _s_t_r_i_n_g, _i_n_t_P_t_r)
-
- int
- Tcl_GetDouble(_i_n_t_e_r_p, _s_t_r_i_n_g, _d_o_u_b_l_e_P_t_r)
-
- int
- Tcl_GetBoolean(_i_n_t_e_r_p, _s_t_r_i_n_g, _b_o_o_l_P_t_r)
-
- ARGUMENTS
- Tcl_Interp *_i_n_t_e_r_p (in) Interpreter to use for
- error reporting.
-
- char *_s_t_r_i_n_g (in) Textual value to be con-
- verted.
-
- int *_i_n_t_P_t_r (out) Points to place to store
- integer value converted
- from _s_t_r_i_n_g.
-
- double *_d_o_u_b_l_e_P_t_r (out) Points to place to store
- double-precision
- floating-point value
- converted from _s_t_r_i_n_g.
-
- int *_b_o_o_l_P_t_r (out) Points to place to store
- boolean value (0 or 1)
- converted from _s_t_r_i_n_g.
- _________________________________________________________________
-
-
- DESCRIPTION
- These procedures convert from strings to integers or
- double-precision floating-point values or booleans
- (represented as 0- or 1-valued integers). Each of the pro-
- cedures takes a _s_t_r_i_n_g argument, converts it to an internal
- form of a particular type, and stores the converted value at
- the location indicated by the procedure's third argument.
- If all goes well, each of the procedures returns TCL_OK. If
- _s_t_r_i_n_g doesn't have the proper syntax for the desired type
- then TCL_ERROR is returned, an error message is left in
- _i_n_t_e_r_p->_r_e_s_u_l_t, and nothing is stored at *_i_n_t_P_t_r or *_d_o_u_b_-
- _l_e_P_t_r or *_b_o_o_l_P_t_r.
-
-
-
- Tcl 1
-
-
-
-
-
-
- Tcl_GetInt(3) Tcl Library Procedures
-
-
-
- Tcl_GetInt expects _s_t_r_i_n_g to consist of a collection of
- integer digits, optionally signed and optionally preceded by
- white space. If the first two characters of _s_t_r_i_n_g are
- ``0x'' then _s_t_r_i_n_g is expected to be in hexadecimal form;
- otherwise, if the first character of _s_t_r_i_n_g is ``0'' then
- _s_t_r_i_n_g is expected to be in octal form; otherwise, _s_t_r_i_n_g
- is expected to be in decimal form.
-
- Tcl_GetDouble expects _s_t_r_i_n_g to consist of a floating-point
- number, which is: white space; a sign; a sequence of
- digits; a decimal point; a sequence of digits; the letter
- ``e''; and a signed decimal exponent. Any of the fields
- may be omitted, except that the digits either before or
- after the decimal point must be present and if the ``e'' is
- present then it must be followed by the exponent number.
-
- Tcl_GetBoolean expects _s_t_r_i_n_g to specify a boolean value.
- If _s_t_r_i_n_g is any of 0, false, no, or off, then
- Tcl_GetBoolean stores a zero value at *_b_o_o_l_P_t_r. If _s_t_r_i_n_g
- is any of 1, true, yes, or on, then 1 is stored at *_b_o_o_l_P_t_r.
- Any of these values may be abbreviated, and upper-case spel-
- lings are also acceptable.
-
-
- KEYWORDS
- boolean, conversion, double, floating-point, integer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Tcl 2
-
-
-
-